<include file="Public:header" />
<include file="Public:left" />
  <form  method="post" enctype="multipart/form-data" id="brandForm">
     <section>
      <h2><strong>会员权限编辑</strong></h2> 
      <input name="id" type="hidden" value="{$id}">
      <ul class="ulColumn2">
       <li>
        <span class="item_name" style="width:120px;">会员名称：</span>
        <input type="text" class="textbox textbox_295" name="name" disabled="disabled" id="account" placeholder="等级名称" value="{$user_find['username']}"/>
       </li>
       <li>
        <span class="item_name" style="width:120px;">企业查询：</span>
        <input type="text" class="textbox textbox_295" name="project_query_num" id="account" placeholder="企业查询" value='<if condition="$num['project']['is_condition'] eq -1">-1<else /><if condition="$num['project']['is_infinite'] eq 1">-2<else />{$num['project']['num']}</if></if>'/>&nbsp;&nbsp;注：输入-2为无限查询，填:-1则没有查询，数字则是可以查询多少条
       </li>
       <li>
        <span class="item_name" style="width:120px;">公式公告：</span>
        <input type="radio" name="formula_condition" value="0" <if condition="$num['formula']['is_condition'] eq 0">checked="checked"</if>/>无限条件&nbsp;&nbsp;
        <input type="radio" name="formula_condition" value="1" <if condition="$num['formula']['is_condition'] eq 1">checked="checked"</if>/>有限条件&nbsp;&nbsp;
        <span id="formula_condition" <if condition="$num['formula']['is_condition'] eq 0">style="display:none"</if>>
          <input type="radio" name="formula_consult" value="-1" <if condition="$num['formula']['formula_consult']['is_consult'] eq -1">checked="checked"</if>/>不可查阅&nbsp;&nbsp;
          <input type="radio" name="formula_consult" value="1" <if condition="$num['formula']['formula_consult']['is_consult'] eq 1">checked="checked"</if>/>可查阅&nbsp;&nbsp;
          <span id='formula_consult' <if condition="$num['formula']['formula_consult']['is_consult'] eq -1">style="display:none"</if>>
              <input type="text" name="formula_consult_num" value="<if condition="$num['formula']['formula_consult']['is_infinite'] eq 1">-2<else />{$num['formula']['formula_consult']['num']}</if>" placeholder="可查询条数">&nbsp;&nbsp;注：输入-2为无限查询
          </span>         
          <span class="item_name" style="width:90px;">公告附件：</span>
          <input type="radio" name="formula_enclosure" value="-1" <if condition="$num['formula']['formula_enclosure']['is_enclosure'] eq -1">checked="checked"</if>/>不可查阅&nbsp;&nbsp;
          <input type="radio" name="formula_enclosure" value="1" <if condition="$num['formula']['formula_enclosure']['is_enclosure'] eq 1">checked="checked"</if>/>可查阅&nbsp;&nbsp;
          <span id='formula_enclosure' <if condition="$num['formula']['formula_enclosure']['is_enclosure'] eq -1">style="display:none"</if>>
              <input type="text" name="formula_enclosure_num" value="<if condition="$num['formula']['formula_enclosure']['is_infinite'] eq 1">-2<else />{$num['formula']['formula_enclosure']['num']}</if>" placeholder="可查阅附件次数">&nbsp;&nbsp;注：输入-2为无限查阅附件
          </span>
          <span class="item_name" style="width:90px;">是否下载：</span>
          <input type="radio" name="formula_down" value="-1" <if condition="$num['formula']['formula_down']['is_down'] eq -1">checked="checked"</if>/>否&nbsp;&nbsp;
          <input type="radio" name="formula_down" value="1" <if condition="$num['formula']['formula_down']['is_down'] eq 1">checked="checked"</if>/>是&nbsp;&nbsp;
          <span id='formula_down' <if condition="$num['formula']['formula_down']['is_down'] eq -1">style="display:none"</if>>
              <input type="text" name="formula_down_num" value="<if condition="$num['formula']['formula_down']['is_infinite'] eq 1">-2<else />{$num['formula']['formula_down']['num']}</if>" placeholder="下载个数">&nbsp;&nbsp;注：输入-2为无限下载次数
          </span>
        </span>
       </li>
       <li>
        <span class="item_name" style="width:120px;">通知公告：</span>
        <input type="radio" name="circular_condition" value="0" <if condition="$num['circular']['is_condition'] eq 0">checked="checked"</if>/>无限条件&nbsp;&nbsp;
        <input type="radio" name="circular_condition" value="1" <if condition="$num['circular']['is_condition'] eq 1">checked="checked"</if>/>有限条件&nbsp;&nbsp;
        <span id="circular_condition" <if condition="$num['circular']['is_condition'] eq 0">style="display:none"</if>>
          <input type="radio" name="circular_consult" value="-1" <if condition="$num['circular']['circular_consult']['is_consult'] eq -1">checked="checked"</if>/>不可查阅&nbsp;&nbsp;
          <input type="radio" name="circular_consult" value="1" <if condition="$num['circular']['circular_consult']['is_consult'] eq 1">checked="checked"</if>/>可查阅&nbsp;&nbsp;
          <span id='circular_consult' <if condition="$num['circular']['circular_consult']['is_consult'] eq -1">style="display:none"</if>>
              <input type="text" name="circular_consult_num" value="<if condition="$num['circular']['circular_consult']['is_infinite'] eq 1">-2<else />{$num['circular']['circular_consult']['num']}</if>" placeholder="可查询条数">&nbsp;&nbsp;注：输入-2为无限查询
          </span>
          <span class="item_name" style="width:90px;">通知附件：</span>
          <input type="radio" name="circular_enclosure" value="-1" <if condition="$num['circular']['circular_enclosure']['is_enclosure'] eq -1">checked="checked"</if>/>不可查阅&nbsp;&nbsp;
          <input type="radio" name="circular_enclosure" value="1" <if condition="$num['circular']['circular_enclosure']['is_enclosure'] eq 1">checked="checked"</if>/>可查阅&nbsp;&nbsp;
          <span id='circular_enclosure' <if condition="$num['circular']['circular_enclosure']['is_enclosure'] eq -1">style="display:none"</if>>
              <input type="text" name="circular_enclosure_num" value="<if condition="$num['circular']['circular_enclosure']['is_infinite'] eq 1">-2<else />{$num['circular']['circular_enclosure']['num']}</if>" placeholder="可查阅附件次数">&nbsp;&nbsp;注：输入-2为无限查阅附件
          </span>
          <span class="item_name" style="width:90px;">是否下载：</span>
          <input type="radio" name="circular_down" value="-1" <if condition="$num['circular']['circular_down']['is_down'] eq -1">checked="checked"</if>/>否&nbsp;&nbsp;
          <input type="radio" name="circular_down" value="1" <if condition="$num['circular']['circular_down']['is_down'] eq 1">checked="checked"</if>/>是&nbsp;&nbsp;
          <span id='circular_down' <if condition="$num['circular']['circular_down']['is_down'] eq -1">style="display:none"</if>>
              <input type="text" name="circular_down_num" value="<if condition="$num['circular']['circular_down']['is_infinite'] eq 1">-2<else />{$num['circular']['circular_down']['num']}</if>" placeholder="下载个数">&nbsp;&nbsp;注：输入-2为无限下载次数
          </span>
        </span>
       </li>
       <li>
        <span class="item_name" style="width:120px;">政策文件：</span>
        <input type="radio" name="policy_condition" value="0" <if condition="$num['policy']['is_condition'] eq 0">checked="checked"</if>/>无限条件&nbsp;&nbsp;
        <input type="radio" name="policy_condition" value="1" <if condition="$num['policy']['is_condition'] eq 1">checked="checked"</if>/>有限条件&nbsp;&nbsp;
        <span id="policy_condition" <if condition="$num['policy']['is_condition'] eq 0">style="display:none"</if>>
          <input type="radio" name="policy_consult" value="-1" <if condition="$num['policy']['policy_consult']['is_consult'] eq -1">checked="checked"</if>/>不可查阅&nbsp;&nbsp;
          <input type="radio" name="policy_consult" value="1" <if condition="$num['policy']['policy_consult']['is_consult'] eq 1">checked="checked"</if>/>可查阅&nbsp;&nbsp;
          <span id='policy_consult' <if condition="$num['policy']['policy_consult']['is_consult'] eq -1">style="display:none"</if>>
              <input type="text" name="policy_consult_num" value="<if condition="$num['policy']['policy_consult']['is_infinite'] eq 1">-2<else />{$num['policy']['policy_consult']['num']}</if>" placeholder="可查询条数">&nbsp;&nbsp;注：输入-2为无限查询
          </span>
          <span class="item_name" style="width:90px;">政策附件：</span>
          <input type="radio" name="policy_enclosure" value="-1" <if condition="$num['policy']['policy_enclosure']['is_enclosure'] eq -1">checked="checked"</if>/>不可查阅&nbsp;&nbsp;
          <input type="radio" name="policy_enclosure" value="1" <if condition="$num['policy']['policy_enclosure']['is_enclosure'] eq 1">checked="checked"</if>/>可查阅&nbsp;&nbsp;
          <span id='policy_enclosure' <if condition="$num['policy']['policy_enclosure']['is_enclosure'] eq -1">style="display:none"</if>>
              <input type="text" name="policy_enclosure_num" value="<if condition="$num['policy']['policy_enclosure']['is_infinite'] eq 1">-2<else />{$num['policy']['policy_enclosure']['num']}</if>" placeholder="可查阅条数">&nbsp;&nbsp;注：输入-2为无限查阅条数
          </span>

          <span class="item_name" style="width:90px;">是否下载：</span>
          <input type="radio" name="policy_down" value="-1" <if condition="$num['policy']['policy_down']['is_down'] eq -1">checked="checked"</if>/>否&nbsp;&nbsp;
          <input type="radio" name="policy_down" value="1" <if condition="$num['policy']['policy_down']['is_down'] eq 1">checked="checked"</if>/>是&nbsp;&nbsp;
          <span id='policy_down' <if condition="$num['policy']['policy_down']['is_down'] eq -1">style="display:none"</if>>
              <input type="text" name="policy_down_num" value="<if condition="$num['policy']['policy_down']['is_infinite'] eq 1">-2<else />{$num['policy']['policy_down']['num']}</if>" placeholder="可下载条数">&nbsp;&nbsp;注：输入-2为无限下载条数
          </span>
        </span>
       </li>
       <li>
        <span class="item_name" style="width:120px;">企业关注：</span>
        <input type="text" class="textbox textbox_295" name="enterprise_follow_num" id="account" placeholder="企业关注数" value='<if condition="$num['enterprise_follow_num']['is_condition'] eq -1">-1<else /><if condition="$num['enterprise_follow_num']['is_infinite'] eq 1">-2<else />{$num['enterprise_follow_num']['num']}</if></if>'/>&nbsp;&nbsp;注：输入-2为无限关注，填:-1则没有企业关注，数字则是有限次数
       </li>
       <li>
        <span class="item_name" style="width:120px;">微信推文：</span>
        <input type="text" class="textbox textbox_295" name="wechat_tweets_num" id="account" placeholder="微信推文" value='<if condition="$num['wechat_tweets_num']['is_condition'] eq -1">-1<else /><if condition="$num['wechat_tweets_num']['is_infinite'] eq 1">-2<else />{$num['wechat_tweets_num']['num']}</if></if>'/>&nbsp;&nbsp;注：是条数/月,如输入-2则不限制，填:-1则没有微信推文，数字则是有限次数
       </li>
       <li>
        <span class="item_name" style="width:120px;">政策解读：</span>
        <input type="text" class="textbox textbox_295" name="interpretation_num" id="account" placeholder="政策解读" value='<if condition="$num['policy_interpretation_num']['is_condition'] eq -1">-1<else /><if condition="$num['policy_interpretation_num']['is_infinite'] eq 1">-2<else />{$num['policy_interpretation_num']['num']}</if></if>'/>&nbsp;&nbsp;注：-2无限，填:-1则没有政策解读，数字则是有限次数
       </li>
       <li>
        <span class="item_name" style="width:120px;">申报跟踪通知：</span>
        <input type="text" class="textbox textbox_295" name="tracking_bulletin_num" id="account" placeholder="企业申报跟踪通知" value='<if condition="$num['tracking_bulletin_num']['is_condition'] eq -1">-1<else /><if condition="$num['tracking_bulletin_num']['is_infinite'] eq 1">-2<else />{$num['tracking_bulletin_num']['num']}</if></if>'/>&nbsp;&nbsp;注：有限期内次数,-2无限 填:-1则没有企业申报跟踪通知，数字则是有限次数
       </li>
       <li>
        <span class="item_name" style="width:120px;">企业规划：</span>
        <input type="text" class="textbox textbox_295" name="enterprise_planning_num" id="account" placeholder="企业规划" value='<if condition="$num['enterprise_planning_num']['is_condition'] eq -1">-1<else /><if condition="$num['enterprise_planning_num']['is_infinite'] eq 1">-2<else />{$num['enterprise_planning_num']['num']}</if></if>'/>&nbsp;&nbsp;注：有限期内次数,-2无限 填:-1则没有企业规划，数字则是有限次数
       </li>
       <li>
        <span class="item_name" style="width:120px;">企业项目顾问：</span>
        <input type="radio" name="business_doctor" value="0" <if condition="$num['business_doctor'] eq 0">checked="checked"</if>/>没有&nbsp;&nbsp;
        <input type="radio" name="business_doctor" value="1" <if condition="$num['business_doctor'] eq 1">checked="checked"</if>/>有&nbsp;&nbsp;
       </li>
       <li>
        <span class="item_name" style="width:120px;">项目信息维护：</span>
        <input type="radio" name="information_maintenance" value="0" checked="checked" <if condition="$num['information_maintenance'] eq 0">checked="checked"</if>/>没有&nbsp;&nbsp;
        <input type="radio" name="information_maintenance" value="1" <if condition="$num['information_maintenance'] eq 1">checked="checked"</if>/>有&nbsp;&nbsp;
       </li>
       <li>
          <span class="item_name" style="width:120px;"></span>
          <input type="button" class="link_btn" value="提交"/>
        </li>
      </ul>
     </section>
   </form>
   
  <script type="text/javascript">
    //表单切换
    $("input[name='formula_condition'],input[name='circular_condition'],input[name='policy_condition'],input[name='formula_consult'],input[name='formula_enclosure'],input[name='formula_down'],input[name='circular_consult'],input[name='circular_enclosure'],input[name='circular_down'],input[name='policy_consult'],input[name='policy_enclosure'],input[name='policy_down']").change(function(){
        var input_val = $(this).val();
        var name = $(this).attr('name');
      
        if(input_val == '1'){
            $("#"+name+"").show();
        }else{
            $("#"+name+"").hide();
        }
    });
    
    $(".link_btn").click(function(){
        if($("input[name='name']").val()==""){
            layer.alert("会员等级名称不能为空!",{
              btn:['确认'],
              yes:function(){
                $("input[name='name']").focus();
                layer.close(layer.index);
              }
            });
            return false;
        }
      
        var bool = false;
        var mycars=new Array();
        var input_name = '';

        mycars[0]="formula_condition";
        mycars[1]="circular_condition";
        mycars[2]="policy_condition";


        $("input[name$=_num]").each(function(){
            var name = $(this).attr('name');
            //检测项目查询,公式公告,通知公告，政策文件的输入框
            var name_result = $(this).attr('name');
            var name_result = name_result.split('_');

            var inarray_result = $.inArray(""+name_result[0]+"_condition", mycars);

            if(inarray_result == '-1'){
              if($(this).val() == "" || isNaN($(this).val())){
                bool = true;
                input_name = $(this).attr('name');
                return false;
              }
            }else{
              var condition_val = $(this).parent().parent().parent().find("input[name="+name_result[0]+"_condition]:checked").val();
              if(condition_val == '1'){
                var id = $(this).parent().attr('id');
                var name_val = $(this).parent().parent().find("input[name='"+id+"']:checked").val();
                if(name_val == '1'){
                  if($(this).val() == "" || isNaN($(this).val())){
                    bool = true;
                    input_name = $(this).attr('name');
                    
                    return false;
                  }
                }
              }
            }
        });

        if(bool){
          layer.alert("输入框为空或者不是数字!",{
            btn:['确认'],
            yes:function(){
              $("input[name='"+input_name+"']").focus();
              layer.close(layer.index);
            }
          });
          
          return false;
        }

      var name = $('input[name="name"]').val();
      var id = $('input[name="id"]').val();

      var project_query_num = $('input[name="project_query_num"]').val();

      //公式公告
      var formula_condition = $('input[name="formula_condition"]:checked').val();
      var formula_consult = $('input[name="formula_consult"]:checked').val();
      var formula_consult_num = $('input[name="formula_consult_num"]').val();
      var formula_enclosure = $('input[name="formula_enclosure"]:checked').val();
      var formula_enclosure_num = $('input[name="formula_enclosure_num"]').val();
      var formula_down = $('input[name="formula_down"]:checked').val();
      var formula_down_num = $('input[name="formula_down_num"]').val();

      //通知公告
      var circular_condition = $('input[name="circular_condition"]:checked').val();
      var circular_consult = $('input[name="circular_consult"]:checked').val();
      var circular_consult_num = $('input[name="circular_consult_num"]').val();
      var circular_enclosure = $('input[name="circular_enclosure"]:checked').val();
      var circular_enclosure_num = $('input[name="circular_enclosure_num"]').val();
      var circular_down = $('input[name="circular_down"]:checked').val();
      var circular_down_num = $('input[name="circular_down_num"]').val();

      //政策文件
      var policy_condition = $('input[name="policy_condition"]:checked').val();
      var policy_consult = $('input[name="policy_consult"]:checked').val();
      var policy_consult_num = $('input[name="policy_consult_num"]').val();
      var policy_enclosure = $('input[name="policy_enclosure"]:checked').val();
      var policy_enclosure_num = $('input[name="policy_enclosure_num"]').val();
      var policy_down = $('input[name="policy_down"]:checked').val();
      var policy_down_num = $('input[name="policy_down_num"]').val();

      var enterprise_follow_num = $('input[name="enterprise_follow_num"]').val();
      var wechat_tweets_num = $('input[name="wechat_tweets_num"]').val();
      var interpretation_num = $('input[name="interpretation_num"]').val();
      var tracking_bulletin_num = $('input[name="tracking_bulletin_num"]').val();
      var enterprise_planning_num = $('input[name="enterprise_planning_num"]').val();
      var business_doctor = $('input[name="business_doctor"]:checked').val();
      var information_maintenance = $('input[name="information_maintenance"]:checked').val();
      var term_num = $('input[name="term_num"]').val();

      var json = {name:name,project_query_num:project_query_num,formula_condition:formula_condition,formula_consult:formula_consult,formula_consult_num:formula_consult_num,formula_enclosure:formula_enclosure,formula_enclosure_num:formula_enclosure_num,formula_down:formula_down,formula_down_num:formula_down_num,circular_condition:circular_condition,circular_consult:circular_consult,circular_consult_num:circular_consult_num,circular_enclosure:circular_enclosure,circular_enclosure_num:circular_enclosure_num,circular_down:circular_down,circular_down_num:circular_down_num,policy_condition:policy_condition,policy_consult:policy_consult,policy_consult_num:policy_consult_num,policy_enclosure:policy_enclosure,policy_enclosure_num:policy_enclosure_num,policy_down:policy_down,policy_down_num:policy_down_num,enterprise_follow_num:enterprise_follow_num,wechat_tweets_num:wechat_tweets_num,interpretation_num:interpretation_num,tracking_bulletin_num:tracking_bulletin_num,enterprise_planning_num:enterprise_planning_num,business_doctor:business_doctor,information_maintenance:information_maintenance,id:id};

      $.post("{:url('user/user_rights')}",json,function(result){
        if(result.code == '0'){
            layer.alert(result.msg);
        }else{
            layer.alert(result.msg, {   
                btn: ['确定']  
            },  
                function (index, item) { 
                location.href = result.url;
            });  
        }
      });

    });


  </script>
   


 </div>
</section>
</body>
</html>
